package com.devilvan.betrice.aiqicha.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * @author Evad.Wu
 * @Description 爱企查-裁决文书信息 映射
 * @date 2022-09-23
 */
@Setter
@Getter
@ToString(exclude = "aiqichaHeaderPo")
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "AIQICHA_LEGAL_DOC")

@Entity
@Table(name = "AIQICHA_LEGAL_DOC")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "爱企查-裁决文书信息 映射")
public class AiqichaLegalDocPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = 7823027893053256258L;
    @Schema(description = "企业系统ID")
    @TableField(value = "PID")
    @Column(name = "PID", columnDefinition = "BIGINT(19) NOT NULL COMMENT '企业系统ID'")
    private Long pid;
    @Schema(description = "被投资企业")
    @TableField(value = "COMP_NAME")
    @Column(name = "COMP_NAME", columnDefinition = "VARCHAR(128) NOT NULL COMMENT '被投资企业'")
    private String compName;
    @Schema(description = "案件编号")
    @TableField(value = "CASE_NO")
    @Column(name = "CASE_NO", columnDefinition = "VARCHAR(64) NOT NULL COMMENT '案件编号'")
    private String caseNo;
    @Schema(description = "裁决日期")
    @TableField(value = "VERDICT_DATE")
    @Column(name = "VERDICT_DATE", columnDefinition = "DATETIME COMMENT '裁决日期'")
    private Date verdictDate;
    @Schema(description = "案件ID")
    @TableField(value = "WENSHU_ID")
    @Column(name = "WENSHU_ID", columnDefinition = "VARCHAR(128) NOT NULL COMMENT '案件ID'")
    private String wenshuId;
    @Schema(description = "案件名称")
    @TableField(value = "WENSHU_NAME")
    @Column(name = "WENSHU_NAME", columnDefinition = "VARCHAR(128) NOT NULL COMMENT '案件名称'")
    private String wenshuName;
    @Schema(description = "合同纠纷")
    @TableField(value = "TYPE")
    @Column(name = "TYPE", columnDefinition = "VARCHAR(64) COMMENT '合同纠纷'")
    private String type;
    @Schema(description = "案件身份")
    @TableField(value = "ROLE")
    @Column(name = "ROLE", columnDefinition = "VARCHAR(32) COMMENT '案件身份'")
    private String role;

    @Schema(description = "基本信息")
    @TableField(exist = false)
    @ManyToOne(targetEntity = AiqichaHeaderPo.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "PID", referencedColumnName = "PID", insertable = false, updatable = false)
    private AiqichaHeaderPo aiqichaHeaderPo;
}
